<?php

namespace App\Module\Api\Controllers;

use App\Module\Api\Controllers\Request\QueryIdRequest;
use App\System\Cms\Repositories\CmsArticleRepository;

/**
 * 文章详细
 */
class ArticleDetailsController extends Controller
{
    public function __construct()
    {
        $this->query = new QueryIdRequest();
        parent::__construct();
    }

    public function index()
    {
        $article = CmsArticleRepository::getInstance();
        $info = $article->getArticleByType(1);
        $article_info = ['id'=>$info->id,'title'=>$info->title,'content'=>$info->content,'timestamp'=>$info->created_at->toDateTimeString()];
        return apiResponse(['article'=>$article_info]);
    }
}
